import request from "@/utils/request"

export interface UserInterface {
  id: string //
  account: string | null //
  username: string  
  password: string | null //
  passwordAgain?: string | null //
  createBy?: string | null //
  updateBy?: string | null //
  createTime?: Date | null //
  updateTime?: Date | null //
  delFlag?: '0' | '1' //
  remarks?: string | null //
}


export function getUserList (params?: any) {
  return request({
    url: '/v1/system-user/searchPage',
    method: 'get',
    params
  })
}

export function addUser (data: UserInterface) {
  return request({
    url: '/v1/system-user/add',
    method: 'post',
    data
  })
}

export function userDetail (id: string) {
  return request({
    url: `/v1/system-user/getById`,
    method: 'get',
    params: { id }
  })
}

export function updateUser (data: any) {
  return request({
    url: `/v1/system-user/update`,
    method: 'post',
    data
  })
}

export function deleteUser (id: string) {
  return request({
    url: `/v1/system-user/delete`,
    method: 'POST',
    data: {
      id
    }
  })
}
